<template>
    <div class="AddDict">
      <el-form ref="form" :model="card" label-width="80px">
        <el-form-item label="名字">
          <el-input v-model="card.name"></el-input>
        </el-form-item>
        <el-form-item label="模块类型">
          <template>
            <el-select v-model="card.type" placeholder="请选择" >
              <el-option
                  v-for="(item,index) in cardType"
                  :key=index
                  :label=item.label
                  :value=item.value>
              </el-option>
            </el-select>
          </template>
        </el-form-item>
        <el-form-item label="是否可用">

            <el-switch
                v-model="card.isView"
                active-color="#13ce66"
                inactive-color="#ff4949">
            </el-switch>

        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="onSubmit">提交</el-button>
          <el-button @click="cance">取消</el-button>
        </el-form-item>
      </el-form>
    </div>

</template>

<script >
import {Message} from "element-ui";

export default{
  name:"AddCard",
  data(){
    return{

    }
  },
  props:{
    card: {},
    cardType:[],
  },
  methods:{
    onSubmit() {
      this.postRequestJson("/api/tg/card/addOrEditCardInfo",this.card).then(resp=>{
        if (resp.data.code === '0') {
          Message.success("操作成功")
          this.$emit("chageData",false)
        }
      })
    },
    cance() {
      this.$emit("chageData",false)
    },
  },
  created() {

  }
}
</script>
<style  scoped>

</style>
